<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>flightController.as</title>
<link rel="stylesheet" type="text/css" href="../../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptComment">// ActionScript file
</span><span class="ActionScriptComment">/*
* 航班控制的接口
*/</span>
<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">rpc</span>.<span class="ActionScriptDefault_Text">events</span>.<span class="ActionScriptDefault_Text">ResultEvent</span>;

<span class="ActionScriptComment">//获取机场数据                                             
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">initUI</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>    
    <span class="ActionScriptDefault_Text">FlightService</span>.<span class="ActionScriptDefault_Text">getOperation</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;getAirport&apos;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">()</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//传递到控件            
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getAirportHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>    
    <span class="ActionScriptDefault_Text">startList</span>.<span class="ActionScriptDefault_Text">dataProvider</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>;
    <span class="ActionScriptDefault_Text">endList</span>.<span class="ActionScriptDefault_Text">dataProvider</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//注册事件        
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">addUserHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>    
    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span> <span class="ActionScriptBracket/Brace">)</span>
        <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;注册成功,点击确定跳转到登录窗口&apos;</span>,<span class="ActionScriptString">&apos;注册成功&apos;</span>,<span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">YES</span>,<span class="ActionScriptReserved">this</span>,<span class="ActionScriptDefault_Text">alertHandler</span>,<span class="ActionScriptReserved">null</span>,<span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">YES</span><span class="ActionScriptBracket/Brace">)</span>;
    <span class="ActionScriptReserved">else</span>
        <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;注册失败，用户名被占用&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//响应获取航班事件，并修改控件        
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getResultHandler</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>    
    <span class="ActionScriptDefault_Text">flightList</span>.<span class="ActionScriptDefault_Text">dataProvider</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getResultAllHandler</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>    
    <span class="ActionScriptDefault_Text">flightList0</span>.<span class="ActionScriptDefault_Text">dataProvider</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//获取所有航班，并修改控件    
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getResultHandler0</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>    
    <span class="ActionScriptDefault_Text">flightList0</span>.<span class="ActionScriptDefault_Text">dataProvider</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>;
<span class="ActionScriptBracket/Brace">}</span>
            
<span class="ActionScriptComment">//选择的航班序号
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flightId</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;

<span class="ActionScriptComment">//获取航班座位信息
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getFlightInfoHandler</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">flightId</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    
    <span class="ActionScriptDefault_Text">MService</span>.<span class="ActionScriptDefault_Text">getOperation</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;getRemainseat&apos;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">flightId</span> <span class="ActionScriptBracket/Brace">)</span>;                
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getFlightInfo1Handler</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">backToFlight2</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">flightId1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">flight</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">date1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">date</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">planeId1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">plane</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">start1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">start</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">end1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">end</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">startTime1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">start_time</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">endTime1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">end_time</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">firstSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">first_class</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">firstPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">fprice</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">secondSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">second_class</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">secondPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">sprice</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">thirdSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">third_class</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">thirdPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">tprice</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;    
    <span class="ActionScriptDefault_Text">booked1</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span>.<span class="ActionScriptDefault_Text">booked</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;            
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">init</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
        
        <span class="ActionScriptDefault_Text">flightId1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">date1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">planeId1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">start1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">end1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">startTime1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">endTime1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">firstSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">firstPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">secondSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">secondPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">thirdSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">thirdPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">booked1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
<span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getDelFlightHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span><span class="ActionScriptBracket/Brace">){</span>
        <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;删除成功&apos;</span>,<span class="ActionScriptString">&apos;删除成功&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptDefault_Text">flightId1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">date1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">planeId1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">start1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">end1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">startTime1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">endTime1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">firstSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">firstPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">secondSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">secondPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">thirdSeat1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">thirdPrice1</span>.<span class="ActionScriptDefault_Text">text</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
        <span class="ActionScriptDefault_Text">booked1</span>.<span class="ActionScriptDefault_Text">text</span><span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;&quot;</span>;
    <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptReserved">else</span>
        <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;删除失败,航班不存在&apos;</span>,<span class="ActionScriptString">&apos;删除失败&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>
            
<span class="ActionScriptComment">//剩余座位
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">remainSeat</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;

<span class="ActionScriptComment">///获取剩余座位信息        
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getRemainseatHandler</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">currentState</span><span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;seat&quot;</span>;
    <span class="ActionScriptDefault_Text">remainSeat</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">Array</span>;
    <span class="ActionScriptDefault_Text">seatList</span>.<span class="ActionScriptDefault_Text">dataProvider</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">remainSeat</span>;                        
<span class="ActionScriptBracket/Brace">}</span>
            
<span class="ActionScriptComment">//触发列表单击事件
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getSeat</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">FlightService</span>.<span class="ActionScriptDefault_Text">getOperation</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;getFlightInfo&apos;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">flightList</span>.<span class="ActionScriptDefault_Text">selectedItem</span>.<span class="ActionScriptDefault_Text">id</span> <span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getInfo</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">FlightService</span>.<span class="ActionScriptDefault_Text">getOperation</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;getFlightInfo1&apos;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">flightList0</span>.<span class="ActionScriptDefault_Text">selectedItem</span>.<span class="ActionScriptDefault_Text">id</span> <span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>


<span class="ActionScriptComment">//处理提交订票信息的返回信息
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">orderTicketsHandler</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span> <span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptDefault_Text">CursorManager</span>.<span class="ActionScriptDefault_Text">removeBusyCursor</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span> <span class="ActionScriptBracket/Brace">)</span>
        <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;订票成功,点击确定跳转到主页面&apos;</span>,<span class="ActionScriptString">&apos;订票成功&apos;</span>,<span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">YES</span>,<span class="ActionScriptReserved">this</span>,<span class="ActionScriptDefault_Text">alertHandler</span>,<span class="ActionScriptReserved">null</span>,<span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">YES</span><span class="ActionScriptBracket/Brace">)</span>;
    <span class="ActionScriptReserved">else</span>
        <span class="ActionScriptDefault_Text">Alert</span>.<span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;订票失败，请重新选择，或者检查网络是否连通&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">//提交订票信息
</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">order</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">seat</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">seatList</span>.<span class="ActionScriptDefault_Text">selectedItems</span>; <span class="ActionScriptComment">//获取选择的座位
</span>    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">ix</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0;
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">seatStr</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span>; <span class="ActionScriptComment">//存储整合的字符串
</span>    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">quantity</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">seat</span>.<span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptComment">//座位个数
</span>    <span class="ActionScriptReserved">for</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">ix</span> <span class="ActionScriptOperator">=</span> 0 ; <span class="ActionScriptDefault_Text">ix</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">quantity</span>; <span class="ActionScriptDefault_Text">ix</span><span class="ActionScriptOperator">++</span> <span class="ActionScriptBracket/Brace">)</span>
    <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">seatStr</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span> <span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptDefault_Text">seatStr</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">seat</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">ix</span><span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptString">&apos;label&apos;</span><span class="ActionScriptBracket/Brace">]</span>;
        <span class="ActionScriptReserved">else</span>
            <span class="ActionScriptDefault_Text">seatStr</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">seatStr</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;,&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">seat</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">ix</span><span class="ActionScriptBracket/Brace">][</span><span class="ActionScriptString">&apos;label&apos;</span><span class="ActionScriptBracket/Brace">]</span>;    
    <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptDefault_Text">FlightService</span>.<span class="ActionScriptDefault_Text">getOperation</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;orderTickets&apos;</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptDefault_Text">flightId</span>, <span class="ActionScriptDefault_Text">userId</span>, <span class="ActionScriptDefault_Text">seatStr</span>, <span class="ActionScriptDefault_Text">quantity</span>  <span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span></pre></body>
</html>
